/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

var App = require('app');

require('config');

require('messages');
require('utils/base64');
require('utils/db');
require('utils/helper');
require('utils/config');
require('mixins');
require('models');
require('controllers');
require('views');
require('router');
require('mappers');

require('utils/ajax/ajax');
require('utils/ajax/ajax_queue');

var files = ['test/init_model_test',
  'test/app_test',
  'test/data/HDP2/secure_mapping_test',
  'test/controllers/global/background_operations_test',
  'test/controllers/global/cluster_controller_test',
  'test/controllers/global/update_controller_test',
  'test/controllers/global/configuration_controller_test',
  'test/controllers/main/alert_definitions_controller_test',
  'test/controllers/main/alerts/alert_definitions_actions_controller_test',
  'test/controllers/main/alerts/definitions_configs_controller_test',
  'test/controllers/main/alerts/definitions_details_controller_test',
  'test/controllers/main/alerts/alert_instances_controller_test',
  'test/controllers/main/alerts/add_alert_definition/step1_controller_test',
  'test/controllers/main/alerts/manage_alert_notifications_controller_test',
  'test/controllers/main/admin/kerberos_test',
  'test/controllers/main/admin/kerberos/kerberos_wizard_controler_test',
  'test/controllers/main/admin/kerberos/step2_controller_test',
  'test/controllers/main/admin/kerberos/step3_controller_test',
  'test/controllers/main/admin/kerberos/step4_controller_test',
  'test/controllers/main/admin/kerberos/step6_controller_test',
  'test/controllers/main/admin/stack_and_upgrade_controller_test',
  'test/controllers/main/admin/serviceAccounts_controller_test',
  'test/controllers/main/admin/highAvailability_controller_test',
  'test/controllers/main/admin/highAvailability/progress_controller_test',
  'test/controllers/main/admin/highAvailability/progress_popup_controller_test',
  'test/controllers/main/admin/highAvailability/nameNode/step2_controller_test',
  'test/controllers/main/admin/highAvailability/nameNode/step3_controller_test',
  'test/controllers/main/admin/highAvailability/nameNode/step4_controller_test',
  'test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test',
  'test/controllers/main/dashboard/config_history_controller_test',
  'test/controllers/main/charts/heatmap_test',
  'test/controllers/main/charts/heatmap_metrics/heatmap_metric_test',
  'test/controllers/main/alerts/manage_alert_groups_controller_test',
  'test/controllers/main/host/add_controller_test',
  'test/controllers/main/host/configs_service_test',
  'test/controllers/main/host/details_test',
  'test/controllers/main/host/addHost/step4_controller_test',
  'test/controllers/main/service/add_controller_test',
  'test/controllers/main/service/manage_config_groups_controller_test',
  'test/controllers/main/service/reassign_controller_test',
  'test/controllers/main/service/reassign/step1_controller_test',
  'test/controllers/main/service/reassign/step2_controller_test',
  'test/controllers/main/service/reassign/step4_controller_test',
  'test/controllers/main/service/reassign/step6_controller_test',
  'test/controllers/main/service/reassign/step7_controller_test',
  'test/controllers/main/service/widgets/create/wizard_controller_test',
  'test/controllers/main/service/widgets/create/step1_controller_test',
  'test/controllers/main/service/widgets/create/step2_controller_test',
  'test/controllers/main/service/widgets/create/step3_controller_test',
  'test/controllers/main/dashboard_test',
  'test/controllers/main/host_test',
  'test/controllers/main/service/item_test',
  'test/controllers/main/service/info/config_test',
  'test/controllers/main/service/info/summary_test',
  'test/controllers/main/service_test',
  'test/controllers/main/admin_test',
  'test/controllers/main/views_controller_test',
  'test/controllers/installer_test',
  'test/controllers/application_test',
  'test/controllers/main_test',
  'test/controllers/login_controller_test',
  'test/controllers/wizard_test',
  'test/controllers/wizard/slave_component_groups_controller',
  'test/controllers/wizard/step0_test',
  'test/controllers/wizard/step2_test',
  'test/controllers/wizard/step3_test',
  'test/controllers/wizard/step4_test',
  'test/controllers/wizard/step5_test',
  'test/controllers/wizard/step6_test',
  'test/controllers/wizard/step7_test',
  'test/controllers/wizard/step8_test',
  'test/controllers/wizard/step9_test',
  'test/controllers/wizard/step10_test',
  'test/login_test',
  'test/router_test',
  'test/mappers/alert_groups_mapper_test',
  'test/mappers/alert_instances_mapper_test',
  'test/mappers/alert_definitions_mapper_test',
  'test/mappers/alert_definition_summary_mapper_test',
  'test/mappers/server_data_mapper_test',
  'test/mappers/hosts_mapper_test',
  'test/mappers/service_mapper_test',
  'test/mappers/service_metrics_mapper_test',
  'test/mappers/status_mapper_test',
  'test/mappers/users_mapper_test',
  'test/mappers/stack_mapper_test',
  'test/mappers/stack_service_mapper_test',
  'test/mappers/configs/stack_config_properties_mapper_test',
  'test/mappers/configs/config_groups_mapper_test',
  'test/mappers/configs/config_versions_mapper_test',
  'test/mappers/configs/themes_mapper_test',
  'test/mixins/common/configs/enhanced_configs_test',
  'test/mixins/common/configs/configs_saver_test',
  'test/mixins/common/configs/toggle_isrequired_test',
  'test/mixins/common/chart/storm_linear_time_test',
  'test/mixins/common/widgets/widget_section_test',
  'test/mixins/common/localStorage_test',
  'test/mixins/common/reload_popup_test',
  'test/mixins/common/serverValidator_test',
  'test/mixins/common/table_server_view_mixin_test',
  'test/mixins/common/widget_mixin_test',
  'test/mixins/main/host/details/host_components/decommissionable_test',
  'test/mixins/main/service/configs/widget_popover_support_test',
  'test/mixins/routers/redirections_test',
  'test/mixins/wizard/addSeccurityConfigs_test',
  'test/mixins/wizard/wizard_menu_view_test',
  'test/mixins/wizard/wizardProgressPageController_test',
  'test/mixins/wizard/wizardEnableDone_test',
  'test/mixins/unit_convert/base_unit_convert_mixin_test',
  'test/utils/ajax/ajax_test',
  'test/utils/ajax/ajax_queue_test',
  'test/utils/batch_scheduled_requests_test',
  'test/utils/blueprint_test',
  'test/utils/config_test',
  'test/utils/date_test',
  'test/utils/data_manipulation_test',
  'test/utils/config_test',
  'test/utils/form_field_test',
  'test/utils/host_progress_popup_test',
  'test/utils/misc_test',
  'test/utils/number_utils_test',
  'test/utils/validator_test',
  'test/utils/config_test',
  'test/utils/string_utils_test',
  'test/utils/helper_test',
  'test/utils/object_utils_test',
  'test/utils/ui_effects_test',
  'test/utils/updater_test',
  'test/utils/configs/database_test',
  'test/utils/configs/config_property_helper_test',
  'test/utils/configs/modification_handlers/modification_handler_test',
  'test/utils/configs/modification_handlers/misc_test',
  'test/views/common/chart/linear_time_test',
  'test/views/common/configs/widgets/combo_config_widget_view_test',
  'test/views/common/configs/widgets/config_widget_view_test',
  'test/views/common/configs/widgets/list_config_widget_view_test',
  'test/views/common/configs/widgets/slider_config_widget_view_test',
  'test/views/common/configs/widgets/toggle_config_widget_view_test',
  'test/views/common/ajax_default_error_popup_body_test',
  'test/views/common/filter_combo_cleanable_test',
  'test/views/common/filter_view_test',
  'test/views/common/table_view_test',
  'test/views/common/quick_link_view_test',
  'test/views/common/rolling_restart_view_test',
  'test/views/common/modal_popup_test',
  'test/views/common/sort_view_test',
  'test/views/common/custom_date_popup_test',
  'test/views/common/progress_bar_view_test',
  'test/views/common/widget/graph_widget_view_test',
  'test/views/common/widget/number_widget_view_test',
  'test/views/common/widget/gauge_widget_view_test',
  'test/views/common/modal_popups/hosts_table_list_popup_test',
  'test/views/common/modal_popups/dependent_configs_list_popup_test',
  'test/views/main/admin_test',
  'test/views/main/dashboard_test',
  'test/views/main/menu_test',
  'test/views/main/host_test',
  'test/views/main/alert_definitions_view_test',
  'test/views/main/alerts/manage_alert_groups_view_test',
  'test/views/main/alerts/manage_alert_notifications_view_test',
  'test/views/main/alerts/definition_details_view_test',
  'test/views/main/admin/stack_upgrade/upgrade_version_box_view_test',
  'test/views/main/admin/stack_upgrade/upgrade_group_view_test',
  'test/views/main/admin/stack_upgrade/upgrade_task_view_test',
  'test/views/main/admin/stack_upgrade/upgrade_wizard_view_test',
  'test/views/main/admin/stack_upgrade/version_view_test',
  'test/views/main/admin/stack_upgrade/services_view_test',
  'test/views/main/admin/stack_upgrade/menu_view_test',
  'test/views/main/dashboard/config_history_view_test',
  'test/views/main/dashboard/widget_test',
  'test/views/main/dashboard/widgets_test',
  'test/views/main/dashboard/cluster_metrics/memory_test',
  'test/views/main/dashboard/widgets/text_widget_test',
  'test/views/main/dashboard/widgets/uptime_text_widget_test',
  'test/views/main/dashboard/widgets/node_managers_live_test',
  'test/views/main/dashboard/widgets/datanode_live_test',
  'test/views/main/dashboard/widgets/hbase_average_load_test',
  'test/views/main/dashboard/widgets/hbase_regions_in_transition_test',
  'test/views/main/dashboard/widgets/namenode_rpc_test',
  'test/views/main/dashboard/widgets/hbase_master_uptime_test',
  'test/views/main/dashboard/widgets/namenode_uptime_test',
  'test/views/main/dashboard/widgets/resource_manager_uptime_test',
  'test/views/main/dashboard/widgets/links_widget_test',
  'test/views/main/dashboard/widgets/pie_chart_widget_test',
  'test/views/main/dashboard/widgets/namenode_cpu_test',
  'test/views/main/host/details_test',
  'test/views/main/host/summary_test',
  'test/views/main/host/menu_test',
  'test/views/main/host/stack_versions_view_test',
  'test/views/main/host/host_alerts_view_test',
  'test/views/main/host/details/host_component_view_test',
  'test/views/main/host/details/host_component_views/decommissionable_test',
  'test/views/main/host/details/host_component_views/datanode_view_test',
  'test/views/main/host/details/host_component_views/nodemanager_view_test',
  'test/views/main/host/details/host_component_views/regionserver_view_test',
  'test/views/main/host/details/host_component_views/tasktracker_view_test',
  'test/views/main/charts/heatmap_test',
  'test/views/main/charts/heatmap/heatmap_host_test',
  'test/views/main/service/item_test',
  'test/views/main/service/info/config_test',
  'test/views/main/service/info/summary_test',
  'test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test',
  'test/views/main/service/services/ranger_test',
  'test/views/main/service/widgets/create/expression_view_test',
  'test/views/main/admin/highAvailability/nameNode/step1_view_test',
  'test/views/main/admin/highAvailability/nameNode/step3_view_test',
  'test/views/main/admin/highAvailability/nameNode/step4_view_test',
  'test/views/main/admin/highAvailability/nameNode/step6_view_test',
  'test/views/main/admin/highAvailability/nameNode/step8_view_test',
  'test/views/main/admin/highAvailability/nameNode/wizard_view_test',
  'test/views/common/configs/config_history_flow_test',
  'test/views/common/configs/overriddenProperty_view_test',
  'test/views/common/configs/service_config_view_test',
  'test/views/common/configs/service_config_container_view_test',
  'test/views/common/configs/service_configs_by_category_view_test',
  'test/views/common/configs/custom_category_views/notification_configs_view_test',
  'test/views/common/controls_view_test',
  'test/views/common/configs/widgets/time_interval_spinner_view_test',
  'test/views/common/form/spinner_input_view_test',
  'test/views/wizard/step3/hostLogPopupBody_view_test',
  'test/views/wizard/step3/hostWarningPopupBody_view_test',
  'test/views/wizard/step3/hostWarningPopupFooter_view_test',
  'test/views/wizard/step0_view_test',
  'test/views/wizard/step1_view_test',
  'test/views/wizard/step2_view_test',
  'test/views/wizard/step3_view_test',
  'test/views/wizard/step5_view_test',
  'test/views/wizard/step6_view_test',
  'test/views/wizard/step8_view_test',
  'test/views/wizard/step9_view_test',
  'test/views/wizard/step9/hostLogPopupBody_view_test',
  'test/views/wizard/step10_view_test',
  'test/views/application_test',
  'test/views/experimental_test',
  'test/views/installer_test',
  'test/views/login_test',
  'test/models/service/flume_test',
  'test/models/service/hdfs_test',
  'test/models/service/yarn_test',
  'test/models/alert_config_test',
  'test/models/alert_definition_test',
  'test/models/alert_instance_test',
  'test/models/authentication_test',
  'test/models/cluster_states_test',
  'test/models/config_group_test',
  'test/models/form_test',
  'test/models/host_test',
  'test/models/host_component_test',
  'test/models/hosts_test',
  'test/models/operating_system_test',
  'test/models/repository_test',
  'test/models/stack_service_component_test',
  'test/models/service_test',
  'test/models/stack_service_test',
  'test/models/user_test',
  'test/models/host_stack_version_test',
  'test/models/upgrade_entity_test',
  'test/models/configs/sub_section_test',
  'test/models/configs/section_test',
  'test/models/configs/service_config_version_test',
  'test/models/configs/config_property_test',
  'test/models/configs/objects/service_config_test',
  'test/models/configs/objects/service_config_category_test',
  'test/models/configs/objects/service_config_property_test',
  'test/routes/views_test',
  //contains test with fake timers that affect Date
  'test/utils/lazy_loading_test'
];

App.initialize();
describe('Ambari Web Unit tests', function() {

  for (var i = 0; i < files.length; i++) {

    describe(files[i], function() {
      require(files[i]);
    });

  }

});
